﻿using System;
using System.Runtime.InteropServices;

namespace Mrsoft.Model
{
    public class Skill
    {
        public Skill()
            : this(true, -1, int.MaxValue) { }

        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="isAnJian">是否是按键技能</param>
        /// <param name="skillID">技能的数字ID</param>
        /// <param name="coolDown">技能冷却时间</param>
        /// <param name="isNeedTarget">内存技能释放是否需要对象</param>
        /// <param name="isRangeSkill">是否是范围释放技能</param>
        /// <param name="duration">技能释放持续时间</param>
        public Skill(bool isAnJian, int skillID, int coolDown, bool isNeedTarget = false, bool isRangeSkill = false, int duration = 0)
        {
            SkillID = skillID;
            CoolDown = coolDown;
            Duration = duration;
            IsAnJian = isAnJian;
            IsNeedTarget = isNeedTarget;
            IsRangeSkill = isRangeSkill;
            LastReleaseTime = DateTime.Now.AddMinutes(-10);
        }

        /// <summary>
        /// 技能的ID或者对应的按键码
        /// </summary>
        public int SkillID;

        /// <summary>
        /// 冷却时间
        /// </summary>
        public int CoolDown;

        /// <summary>
        /// 释放的时候的持续时间
        /// </summary>
        public int Duration;

        /// <summary>
        /// 判断是用按键还是调用Call
        /// </summary>
        public bool IsAnJian;

        /// <summary>
        /// 判断是否哦需要传递坐标为参数
        /// </summary>
        public bool IsRangeSkill;

        /// <summary>
        /// 判断是否需要传递目标对象参数
        /// </summary>
        public bool IsNeedTarget;

        /// <summary>
        /// 上次释放的时间
        /// </summary>
        public DateTime LastReleaseTime;

        /// <summary>
        /// 技能的名字
        /// </summary>
        public string Name;

        public override string ToString()
        {
            return string.Format("{2},{0},{1}", SkillID, CoolDown, Name);
        }
    }
}
